﻿/**********************************************************************
 * @file   GUIMaterialPropDialog.h
 * @brief  材料窗口基类声明
 * @author wangning (2185896382@qq.com)
 * @date   2025-05-23
 *********************************************************************/
#ifndef _GUIMaterialPropDialog_H
#define _GUIMaterialPropDialog_H

#include "GUIAnalysisDialogAPI.h"
#include "FITK_Kernel/FITKCore/FITKActionOperator.h"
#include "FITK_Kernel/FITKCore/FITKAbstractGUIDialog.h"

class QComboBox;
class QTreeWidgetItem;
class QString;

namespace Ui
{
    class GUIMaterialPropDialog;
}
namespace Interface
{
    class FITKAbstractMaterial;
    class FITKMaterialManager;
}
namespace GUI
{
    /**
     * @brief  材料窗口基类声明
     * @author wangning (2185896382@qq.com)
     * @date   2025-05-23
     */
    class GUIAnalysisDialogAPI GUIMaterialPropDialog : public Core::FITKDialog
    {
        Q_OBJECT;
    public:
        /**
         * @brief load object dialog
         * @param[i]  obj            My Param doc
         * @param[i]  oper           operator
         * @param[i]  parent
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        explicit GUIMaterialPropDialog(Interface::FITKAbstractMaterial* obj, Core::FITKActionOperator* oper, QWidget* parent = nullptr);
        /**
         * @brief Destroy object
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        virtual ~GUIMaterialPropDialog();
        /**
         * @brief    数据初始化
         * @return   void
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        virtual void init() = 0;

    protected:
        /**
         * @brief    创建数据对象
         * @return   bool
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        bool createObjData();
        /**
         * @brief    编辑数据对象
         * @return   boiol
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        bool editObjData();
        /**
         * @brief    检查
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        virtual bool ckeckData();
        /**
        * @brief   添加需要QLineEdit的子Item
        * @param[i]  p     父节点
        * @param[i]  objName    QLineEdit的objName
        * @param[i]  label   新Item的名字
        * @param[i]  unit   数据的单位
        * @author wangning (2185896382@qq.com)
        * @date   2025-05-23
        */
        QTreeWidgetItem* addChiledItem(QTreeWidgetItem* p, const QString& objName, const QString& label, const QString& unit="");
        /**
         * @brief    从界面获取数据
         * @return   void
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        virtual void getDataFormWidget() = 0;

    protected slots:
        /**
         * @brief    取消事件重写
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        void reject() override;
        /**
        * @brief OK按钮信号
        * @return
        */
        void on_pushButtonOK_clicked();
        /**
        * @brief cancle按钮信号
        * @return
          */
        void on_pushButtonCancel_clicked();

    protected:
        /**
        * @brief 材料管理器
        * @author wangning (2185896382@qq.com)
        * @date   2025-05-23
        */
        Interface::FITKMaterialManager* _matMgr = nullptr;
        /**
         * @brief 材料数据对象
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        Interface::FITKAbstractMaterial* _obj = nullptr;
        /**
         * @brief 操作器对象
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        Core::FITKActionOperator* _oper = nullptr;
        /**
         * @brief  是否是创建
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        bool _isCreate = false;
    protected:
        /**
         * @brief ui 
         * @author wangning (2185896382@qq.com)
         * @date   2025-05-23
         */
        Ui::GUIMaterialPropDialog* _ui = nullptr;
    };
}

#endif
